package testPackage.testPackage;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

/**
 * step by step 08 右键单击 Actions类
 */
public class Selenium09 {
    public static void main(String[] args) throws InterruptedException {
        String str = "D:\\\\Enviroments\\\\geckodriver-v0.26.0-win64\\\\chromedriver.exe";
        System.setProperty("webdriver.chrome.driver",str);
        WebDriver driver = new ChromeDriver();
        driver.get("https://artoftesting.com/samplesiteforselenium");
        //Thread.sleep(3000);
        //右键单击
        //创建Actions类对象
        Actions action = new Actions(driver);
        //将要右键单击的元素作为参数传递给Actions的raceClick()方法
        WebElement element = driver.findElement(By.id("fname"));
        //调用perform()方法执行生成的动作
        action.contextClick(element).perform();
        Thread.sleep(3000);
        driver.quit();

    }
}
